home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / modules / nessus-2.2.8.mo / usr / lib / nessus / plugins / smb_virii.nasl < prev    next >
Text File  |  2005-01-14  |  15KB  |  546 lines

  1. #
  2. # This script was written by Renaud Deraison
  3. #
  4. # See the Nessus Scripts License for details
  5. #
  6.  
  7. if(description)
  8. {
  9.  script_id(11329);
  10.  
  11.  script_version("$Revision: 1.42 $");
  12.  
  13.  name["english"] = "The remote host is infected by a virus";
  14.  
  15.  script_name(english:name["english"]);
  16.  
  17.  desc["english"] = "
  18. This script checks for the presence of different virii on the remote
  19. host, by using the SMB credentials you provide Nessus with.
  20.  
  21. - W32/Badtrans-B
  22. - JS_GIGGER.A@mm
  23. - W32/Vote-A
  24. - CodeRed
  25. - W32.Sircam.Worm@mm
  26. - W32.HLLW.Fizzer@mm
  27. - W32.Sobig.B@mm
  28. - W32.Sobig.E@mm
  29. - W32.Sobig.F@mm
  30. - W32.Sobig.C@mm
  31. - W32.Yaha.J@mm
  32. - W32.mimail.a@mm
  33. - W32.mimail.c@mm
  34. - W32.mimail.e@mm
  35. - W32.mimail.l@mm
  36. - W32.mimail.p@mm
  37. - W32.Welchia.Worm
  38. - W32.Randex.Worm
  39. - W32.Beagle.A
  40. - W32.Novarg.A
  41. - Vesser
  42. - NetSky.C
  43. - Doomran.a
  44. - Beagle.m
  45. - Beagle.j
  46. - Agobot.FO
  47. - NetSky.W
  48. - Sasser
  49. - W32.Wallon.A
  50. - W32.MyDoom.M
  51. - Hackarmy.i
  52. - W32.Erkez.D/Zafi.d
  53.  
  54.     
  55. Risk factor : High
  56. Solution : See the URLs which will appear in the report";
  57.  
  58.  
  59.  script_description(english:desc["english"]);
  60.  
  61.  summary["english"] = "Checks for the presence of different virii on the remote host";
  62.  
  63.  script_summary(english:summary["english"]);
  64.  
  65.  script_category(ACT_GATHER_INFO);
  66.  
  67.  script_copyright(english:"This script is Copyright (C) 2003 Renaud Deraison");
  68.  family["english"] = "Windows";
  69.  script_family(english:family["english"]);
  70.  
  71.  script_dependencies("netbios_name_get.nasl",
  72.               "smb_login.nasl","smb_registry_access.nasl");
  73.  script_require_keys("SMB/name", "SMB/login", "SMB/password",  "SMB/registry_access");
  74.  
  75.  script_require_ports(139, 445);
  76.  exit(0);
  77. }
  78.  
  79. include("smb_nt.inc");
  80. if ( get_kb_item("SMB/samba") ) exit(0);
  81.  
  82. global_var handle;
  83.  
  84. x_name = kb_smb_name();
  85. if(!x_name)exit(0);
  86.  
  87. _smb_port = kb_smb_transport();
  88. if(!_smb_port)exit(0);
  89.  
  90. if(!get_port_state(_smb_port))return(FALSE);
  91. login = kb_smb_login();
  92. pass  = kb_smb_password();
  93. domain = kb_smb_domain();
  94.  
  95. if(!login)login = "";
  96. if(!pass) pass = "";
  97.  
  98.       
  99. soc = open_sock_tcp(_smb_port);
  100. if(!soc)return(FALSE);
  101.  
  102. #
  103. # Request the session
  104. r = smb_session_request(soc:soc,  remote:x_name);
  105. if(!r) { close(soc); return(FALSE); }
  106.  
  107. #
  108. # Negociate the protocol
  109. #
  110. prot = smb_neg_prot(soc:soc);
  111. if(!prot){ close(soc); return(FALSE); }
  112.  
  113.  
  114. #
  115. # Set up our session
  116. #
  117. r = smb_session_setup(soc:soc, login:login, password:pass, domain:domain, prot:prot);
  118. if(!r){ close(soc); return(FALSE); }
  119. # and extract our uid
  120. uid = session_extract_uid(reply:r);
  121.  
  122. #
  123. # Connect to the remote IPC and extract the TID
  124. # we are attributed
  125. #      
  126. r = smb_tconx(soc:soc, name:x_name, uid:uid, share:"IPC$");
  127. # and extract our tree id
  128. tid = tconx_extract_tid(reply:r);
  129. if(!tid){ close(soc); return(FALSE); }
  130.  
  131. #
  132. # Create a pipe to \winreg
  133. #
  134. r = smbntcreatex(soc:soc, uid:uid, tid:tid, name:"\winreg");
  135. if(!r){ close(soc); return(FALSE);}
  136. # and extract its ID
  137. pipe = smbntcreatex_extract_pipe(reply:r);
  138.  
  139. #
  140. # Setup things
  141. #
  142. r = pipe_accessible_registry(soc:soc, uid:uid, tid:tid, pipe:pipe);
  143. if(!r){ close(soc); return(FALSE); }
  144. handle = registry_open_hklm(soc:soc, uid:uid, tid:tid, pipe:pipe);
  145.  
  146.  
  147. function check_reg(name, url, key, item, exp)
  148. {
  149.   local_var key_h, sz;
  150.  
  151.   key_h = registry_get_key(soc:soc, uid:uid, tid:tid, pipe:pipe, key:key, reply:handle);
  152.   if(strlen(key_h) > 92)
  153.   {
  154.     sz =  registry_get_item_sz(soc:soc, uid:uid, tid:tid, pipe:pipe, item:item, reply:key_h);
  155.     registry_close(soc:soc, uid:uid, tid:tid, pipe:pipe, reply:key_h); 
  156.     if ( strlen(sz) <= 92 ) return 0;
  157.     value = registry_decode_sz(data:sz);
  158.     if ( ! value ) return 0;
  159.   }
  160.   else return 0;
  161.   
  162.  if(exp == NULL || tolower(exp) >< tolower(value))
  163.  {
  164.   report = string(
  165. "The virus '", name, "' is present on the remote host\n",
  166. "Solution : ", url, "\n",
  167. "Risk factor : High");
  168.  
  169.   security_hole(port:kb_smb_transport(), data:report);
  170.  }
  171. }
  172.  
  173.  
  174.  
  175.  
  176. i = 0;
  177.  
  178. # http://www.infos3000.com/infosvirus/badtransb.htm
  179. name[i]     = "W32/Badtrans-B";
  180. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.badtrans.b@mm.html";
  181. key[i]         = "Software\Microsoft\Windows\CurrentVersion\RunOnce";
  182. item[i]     = "kernel32";
  183. exp[i]        = "kernel32.exe";
  184.  
  185. i++;
  186.  
  187. # http://www.infos3000.com/infosvirus/jsgiggera.htm
  188. name[i]     = "JS_GIGGER.A@mm";
  189. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/js.gigger.a@mm.html";
  190. key[i]         = "Software\Microsoft\Windows\CurrentVersion\Run";
  191. item[i]     = "NAV DefAlert";
  192. exp[i]        = NULL;
  193.  
  194. i ++;
  195.  
  196. # http://www.infos3000.com/infosvirus/vote%20a.htm
  197. name[i]        = "W32/Vote-A";
  198. url[i]        = "http://www.symantec.com/avcenter/venc/data/w32.vote.a@mm.html";
  199. key[i]        = "Software\Microsoft\Windows\CurrentVersion\Run";
  200. item[i]        = "Norton.Thar";
  201. exp[i]        = "zacker.vbs";
  202.  
  203. i++ ;
  204.  
  205. # http://www.infos3000.com/infosvirus/codered.htm
  206. name[i]        = "CodeRed";
  207. url[i]        = "http://www.symantec.com/avcenter/venc/data/codered.worm.html";
  208. key[i]        = "SYSTEM\CurrentControlSet\Services\W3SVC\Parameters";
  209. item[i]        = "VirtualRootsVC";
  210. exp[i]        = "c:\,,217";
  211.  
  212. i ++;
  213.  
  214. # http://www.infos3000.com/infosvirus/w32sircam.htm
  215. name[i]        = "W32.Sircam.Worm@mm";
  216. url[i]        = "http://www.symantec.com/avcenter/venc/data/w32.sircam.worm@mm.html";
  217. key[i]        = "Software\Microsoft\Windows\CurrentVersion\RunServices";
  218. item[i]        = "Driver32";
  219. exp[i]         = "scam32.exe";
  220.  
  221. i++;
  222.  
  223. name[i]      = "W32.HLLW.Fizzer@mm";
  224. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.hllw.fizzer@mm.html";
  225. key[i]        = "Software\Microsoft\Windows\CurrentVersion\Run";
  226. item[i]        = "SystemInit";
  227. exp[i]        = "iservc.exe";
  228.  
  229. i++;
  230.  
  231. name[i]      = "W32.Sobig.B@mm";
  232. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.sobig.b@mm.html";
  233. key[i]        = "Software\Microsoft\Windows\CurrentVersion\Run";
  234. item[i]        = "SystemTray";
  235. exp[i]        = "msccn32.exe";
  236.  
  237. i ++;
  238.  
  239. name[i]        = "W32.Sobig.E@mm";
  240. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.sobig.e@mm.html";
  241. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  242. item[i]        = "SSK Service";
  243. exp[i]        = "winssk32.exe";
  244.  
  245. i ++;
  246.  
  247. name[i]        = "W32.Sobig.F@mm";
  248. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.sobig.f@mm.html";
  249. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  250. item[i]        = "TrayX";
  251. exp[i]        = "winppr32.exe";
  252.  
  253. i ++;
  254.  
  255. name[i]        = "W32.Sobig.C@mm";
  256. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.sobig.c@mm.html";
  257. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  258. item[i]        = "System MScvb";
  259. exp[i]        = "mscvb32.exe";
  260.  
  261. i ++;
  262.  
  263. name[i]     = "W32.Yaha.J@mm";
  264. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.yaha.j@mm.html";
  265. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  266. item[i]        = "winreg";
  267. exp[i]        = "winReg.exe";
  268.  
  269.  
  270. i++;
  271.  
  272. name[i]     = "W32.mimail.a@mm";
  273. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.mimail.a@mm.html";
  274. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  275. item[i]        = "VideoDriver";
  276. exp[i]        = "videodrv.exe";
  277.  
  278.  
  279. i++;
  280.  
  281. name[i]     = "W32.mimail.c@mm";
  282. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.mimail.c@mm.html";
  283. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  284. item[i]        = "NetWatch32";
  285. exp[i]        = "netwatch.exe";
  286.  
  287. i++;
  288.  
  289. name[i]     = "W32.mimail.e@mm";
  290. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.mimail.e@mm.html";
  291. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  292. item[i]        = "SystemLoad32";
  293. exp[i]        = "sysload32.exe";
  294.  
  295. i++;
  296. name[i]     = "W32.mimail.l@mm";
  297. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.mimail.l@mm.html";
  298. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  299. item[i]        = "France";
  300. exp[i]        = "svchost.exe";
  301.  
  302. i++;
  303. name[i]     = "W32.mimail.p@mm";
  304. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.mimail.p@mm.html";
  305. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  306. item[i]        = "WinMgr32";
  307. exp[i]        = "winmgr32.exe";
  308.  
  309. i++;
  310.  
  311. name[i]        = "W32.Welchia.Worm";
  312. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.welchia.worm.html";
  313. key[i]         = "SYSTEM\CurrentControlSet\Services\RpcTftpd";
  314. item[i]        = "ImagePath";
  315. exp[i]         = "%System%\wins\svchost.exe";
  316.  
  317.  
  318. i++;
  319.  
  320. name[i]        = "W32.Randex.Worm";
  321. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.randex.b.html";
  322. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  323. item[i]        = "superslut";
  324. exp[i]         = "msslut32.exe";
  325.  
  326. i++;
  327.  
  328. name[i]        = "W32.Randex.Worm";
  329. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.randex.c.html";
  330. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  331. item[i]        = "Microsoft Netview";
  332. exp[i]         = "gesfm32.exe";
  333.  
  334. i++;
  335.  
  336. name[i]        = "W32.Randex.Worm";
  337. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.randex.d.html";
  338. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  339. item[i]        = "mssyslanhelper";
  340. exp[i]         = "msmsgri32.exe";
  341.  
  342.  
  343. i++;
  344.  
  345. name[i]        = "W32.Randex.Worm";
  346. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.randex.d.html";
  347. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  348. item[i]        = "mslanhelper";
  349. exp[i]         = "msmsgri32.exe";
  350.  
  351. i ++;
  352. name[i]        = "W32.Beagle.A";
  353. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.beagle.a@mm.html";
  354. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  355. item[i]        = "d3update.exe";
  356. exp[i]         = "bbeagle.exe";
  357.  
  358. i ++;
  359.  
  360. name[i]        = "W32.Novarg.A";
  361. url[i]         = "http://securityresponse.symantec.com/avcenter/venc/data/w32.novarg.a@mm.html";
  362. key[i]         = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  363. item[i]        = "TaskMon";
  364. exp[i]         = "taskmon.exe";
  365.  
  366. i++;
  367.  
  368. name[i]       = "Vesser";
  369. url[i]        = "http://www.f-secure.com/v-descs/vesser.shtml";
  370. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  371. item[i]       = "KernelFaultChk";
  372. exp[i]        = "sms.exe";
  373.  
  374. i++;
  375.  
  376. name[i]       = "NetSky.C";
  377. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.netsky.c@mm.html";
  378. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  379. item[i]       = "ICQ Net";
  380. exp[i]        = "winlogon.exe";
  381.  
  382.  
  383. i++;
  384.  
  385. name[i]      = "Doomran.a";
  386. url[i]       = "http://es.trendmicro-europe.com/enterprise/security_info/ve_detail.php?Vname=WORM_DOOMRAN.A";
  387. key[i]       = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  388. item[i]      = "Antimydoom";
  389. exp[i]       = "PACKAGE.EXE";
  390.  
  391. i++;
  392.  
  393. name[i]      = "Beagle.m";
  394. url[i]       = "http://securityresponse.symantec.com/avcenter/venc/data/w32.beagle.m@mm.html";
  395. key[i]       = "software\microsoft\windows\currentversion\run";
  396. item[i]      = "winupd.exe";
  397. exp[i]       = "winupd.exe";
  398.  
  399. i++;
  400.  
  401. name[i]      = "Beagle.j";
  402. url[i]       = "http://securityresponse.symantec.com/avcenter/venc/data/w32.beagle.j@mm.html";
  403. key[i]       = "software\microsoft\windows\currentversion\run";
  404. item[i]      = "ssate.exe";
  405. exp[i]       = "irun4.exe";
  406.  
  407. i++;
  408.  
  409. name[i]      = "Agobot.FO";
  410. url[i]       = "http://www.f-secure.com/v-descs/agobot_fo.shtml";
  411. key[i]       = "software\microsoft\windows\currentversion\run";
  412. item[i]      = "nVidia Chip4";
  413. exp[i]       = "nvchip4.exe";
  414.  
  415. i ++;
  416. name[i]       = "NetSky.W";
  417. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.netsky.w@mm.html";
  418. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  419. item[i]       = "NetDy";
  420. exp[i]        = "VisualGuard.exe";
  421.  
  422.  
  423. i++;
  424. name[i]       = "Sasser";
  425. url[i]        = "http://www.lurhq.com/sasser.html";
  426. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  427. item[i]       = "avserve.exe";
  428. exp[i]        = "avserve.exe";
  429.  
  430. i++;
  431. name[i]       = "W32.Wallon.A";
  432. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.wallon.a@mm.html";
  433. key[i]        = "SOFTWARE\Microsoft\Internet Explorer\Extensions\{FE5A1910-F121-11d2-BE9E-01C04A7936B1}";
  434. item[i]       = "Icon";
  435. exp[i]        = NULL;
  436.  
  437.  
  438. i++;
  439. name[i]       = "W32.MyDoom.M";
  440. url[i]        = "http://us.mcafee.com/virusInfo/default.asp?id=description&virus_k=127033";
  441. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  442. item[i]       = "JavaVM";
  443. exp[i]        = "JAVA.EXE";
  444.  
  445. i++;
  446. name[i]       = "Hackarmy.i";
  447. url[i]        = "http://www.zone-h.org/en/news/read/id=4404/";
  448. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  449. item[i]       = "putil";
  450. exp[i]        = "%windir%";
  451.  
  452. # Submitted by Jeff Adams
  453. i++;
  454. name[i]       = "W32.Erkez.D/Zafi.D";
  455. url[i]        = "http://securityresponse.symantec.com/avcenter/venc/data/w32.erkez.d@mm.html";
  456. key[i]        = "SOFTWARE\Microsoft\Windows\CurrentVersion\Run";
  457. item[i]       = "Wxp4";
  458. exp[i]        = "Norton Update";
  459.  
  460. for(i=0;name[i];i++)
  461. {
  462.   check_reg(name:name[i], url:url[i], key:key[i], item:item[i], exp:exp[i]);
  463. }
  464.  
  465.  
  466.  
  467. key   = "SOFTWARE\Microsoft\Windows NT\CurrentVersion";
  468. item  = "SystemRoot";
  469.  
  470.  
  471. key_h = registry_get_key(soc:soc, uid:uid, tid:tid, pipe:pipe, key:key, reply:r);
  472. if(key_h)
  473.  {
  474.     sz =  registry_get_item_sz(soc:soc, uid:uid, tid:tid, pipe:pipe, item:item, reply:key_h);
  475.     if ( ! sz ) return 0;
  476.     rootfile = registry_decode_sz(data:sz);
  477.  }
  478.  
  479. if ( ! rootfile ) exit(0);
  480.  
  481. share = ereg_replace(pattern:"([A-Z]):.*", replace:"\1$", string:rootfile);
  482. file =  ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1\system.ini", string:rootfile);
  483.  
  484.  
  485. r = smb_tconx(soc:soc, name:x_name, uid:uid, share:share);
  486. tid = tconx_extract_tid(reply:r);
  487. if(!tid)exit(0);
  488.  
  489. fid = OpenAndX(socket:soc, uid:uid, tid:tid, file:file);
  490. if(fid)
  491. {
  492. off = 0;
  493. resp = ReadAndX(socket:soc, uid:uid, tid:tid, fid:fid, count:16384, off:off);
  494. data = resp;
  495. while(strlen(resp) >= 16383)
  496. {
  497.  off += strlen(resp);
  498.  resp = ReadAndX(socket:soc, uid:uid, tid:tid, fid:fid, count:16384, off:off);
  499.  data += resp;
  500.  if(strlen(data) > 1024 * 1024)break;
  501. }
  502.  
  503. if("shell=explorer.exe load.exe -dontrunold" >< data)
  504. {
  505.   report = string(
  506. "The virus 'W32.Nimda.A@mm' is present on the remote host\n",
  507. "Solution : http://www.symantec.com/avcenter/venc/data/w32.nimda.a@mm.html\n",
  508. "Risk factor : High");
  509.  
  510.   security_hole(port:port, data:report);
  511.  }
  512. }
  513.  
  514. file =  ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1\goner.scr", string:rootfile); 
  515. fid = OpenAndX(socket:soc, uid:uid, tid:tid, file:file);
  516. if(fid){
  517.  report = string(
  518. "The virus 'W32.Goner.A@mm' is present on the remote host\n",
  519. "Solution : http://www.symantec.com/avcenter/venc/data/w32.goner.a@mm.html\n",
  520. "Risk factor : High"); 
  521. security_hole(port:port, data:report);
  522. }
  523.  
  524. file =  ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1\winxp.exe", string:rootfile); 
  525. fid = OpenAndX(socket:soc, uid:uid, tid:tid, file:file);
  526. if(fid){
  527.  report = string(
  528. "The virus 'W32.Bable.AG@mm' is present on the remote host\n",
  529. "Solution : http://www.symantec.com/avcenter/venc/data/w32.beagle.ag@mm.html\n",
  530. "Risk factor : High"); 
  531. security_hole(port:port, data:report);
  532. }
  533.  
  534.  
  535.  
  536. file =  ereg_replace(pattern:"[A-Z]:(.*)", replace:"\1\Swen1.dat", string:rootfile); 
  537. fid = OpenAndX(socket:soc, uid:uid, tid:tid, file:file);
  538. if(fid){
  539.  report = string(
  540. "The virus 'W32.Swen.A@mm' is present on the remote host\n",
  541. "Solution : http://securityresponse.symantec.com/avcenter/venc/data/w32.swen.a@mm.html\n",
  542. "Risk factor : High"); 
  543. security_hole(port:port, data:report);
  544. }
  545.